<?php
namespace Dry\Base;

class SessionBase {

    public function set($key, $value)
    {
        $_SESSION[$key] = $value;
    }

    public function remove($key)
    {
        if(isset($_SESSION[$key])){
            unset($_SESSION[$key]);
        }
    }

    public function get($key, $default='')
    {
        if(isset($_SESSION[$key])){
            return $_SESSION[$key];
        }
        else{
            return $default;
        }
    }

    public function all()
    {
        return $_SESSION;
    }

    public function keys()
    {
        return array_keys($_SESSION);
    }

    public function has($key)
    {
        if(isset($_SESSION[$key])){
            return true;
        }
        else{
            return false;
        }
    }

    public function count()
    {
        return count($_SESSION);
    }

}
?>
